package mlz.c_newDateClass;

import java.time.Instant;

//Instant: 时间戳
public class InstantDemo05 {
    public static void main(String[] args) {
        //1.创建Instant对象,获取当前时间信息
        Instant instant = Instant.now();
        System.out.println(instant); //2024-10-07T05:10:21.047059200Z

        //2.获取总秒数
        long second = instant.getEpochSecond();
        System.out.println(second);//1728277934

        //3.不够1秒的纳秒数
        int nano = instant.getNano();
        System.out.println(nano);//126937700

        //推算
        Instant instant1 = instant.plusNanos(111);
        System.out.println(instant1);


    }
}
